You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The diff is the minimal, correct change for the stated goal: replace silent except: return None with a logged-then-fallback. Function still returns None so the banner path (agent/main.py:985, agent/main.py:1225) is unaffected. No token value is included in the log message, only the description — no secret leakage.
P2: Severity vs. existing pattern in agent/context_manager/manager.py
The other whoami helper in this repo, _get_hf_username at agent/context_manager/manager.py:24, treats whoami failures as logger.warning (e.g. manager.py:63, manager.py:36) — non-fatal degradation, fall back to "unknown". This PR uses logger.exception (ERROR + traceback) for the same class of failure.
Both are defensible — HfApi().whoami() can raise a wider range of exceptions than the curl-based path, so a traceback has more debugging value here. But two notes worth considering:
In interactive mode (cli() at agent/main.py:1414), no basicConfig is called, so an ERROR record falls through to Python's lastResort handler and prints the full traceback to stderr immediately before print_banner runs (agent/main.py:987). On a transient network blip this will produce a multi-line traceback right before the welcome banner. logger.warning("HF whoami failed: %s", exc) (or logger.warning(..., exc_info=True)) would be quieter while still capturing the error — and consistent with the sibling helper.
Headless mode (agent/main.py:1203) uses basicConfig(level=WARNING), so either ERROR or WARNING surfaces there — the choice only affects interactive UX.
Not blocking. The author may reasonably prefer the full traceback; if so, leaving as-is is fine.
· Branch: log-hf-whoami-failures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary